package com.daniel.anno;

import java.lang.reflect.Method;

public class AnalysisCode {
    public static void analysis() throws Exception {
        Class aClass = Class.forName("com.daniel.test.MyAnnoTest");
        Method[] methods = aClass.getMethods();
        if (methods != null) {
            for (Method method : methods) {
                System.out.println("method.getName() = " + method.getName());
                if (method.isAnnotationPresent(MyAnnotation.class)) {
                    method.invoke(aClass.getConstructor(null).newInstance(null), null);
                }
            }
        }
    }
}
